package com.xxcxcxcx.xc_moremob.common.entities.common_mob.taigamob.yeti_zombie;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.xxcxcxcx.xc_moremob.Main;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;

//我们的渲染类要继承GeoEntityRenderer<T>
public class yeti_zombieRender extends GeoEntityRenderer<yeti_zombieEntity>{


    public yeti_zombieRender(EntityRendererProvider.Context renderManager) {
        super(renderManager, new yeti_zombieModel());
        //我们生物的阴影大小
        this.shadowRadius = 0.5f;
    }

    @Override
    public ResourceLocation getTextureLocation(yeti_zombieEntity instance) {
        return new ResourceLocation(Main.MOD_ID, "textures/entity/"+ yeti_zombieModel.name+".png");
    }

    @Override
    public RenderType getRenderType(yeti_zombieEntity animatable, float partialTicks, PoseStack stack,
                                    MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn,
                                    ResourceLocation textureLocation) {
        //如果是幼年动物，就把其按比例缩小
        if(animatable.isBaby()) {
            stack.scale(0.8F, 0.8F, 0.8F);
        } else {
            stack.scale(1F, 1F, 1F);
        }
        //默认原来模型大小
        //stack.scale(1F, 1F, 1F);
        return super.getRenderType(animatable, partialTicks, stack, renderTypeBuffer, vertexBuilder, packedLightIn, textureLocation);
    }
}